/**
 * Created by zhaojm on 15/3/19.
 */
game.DebugNode = cc.Node.extend({
    _debugDrawNode:null,
    ctor:function(){
        this._super();
        this._debugDrawNode = cc.DrawNode.create();
        this.addChild(this._debugDrawNode, 10);

    },
    draw: function (ctx) {
        // override me
        // Only use- this function to draw your staff.
        // DON'T draw your stuff outside this method
        this._super();

        var anchor = this.getAnchorPoint();
        var size = this.getContentSize();

        this._debugDrawNode.clear();

        var vertices = [
            cc.p(0, 0),
            cc.p(0, size.height),
            cc.p(size.width, size.height),
            cc.p(size.width, 0)
        ];
        this._debugDrawNode.drawPoly(vertices, 4, true, new cc.Color(1.0, 1.0, 1.0, 1.0));
        this._debugDrawNode.drawDot(cc.p(anchor.x * size.width, anchor.y * size.height), 5, new cc.Color(1, 1, 1, 1));

    },
});

game.DebugSprite = cc.Sprite.extend({
    _debugDrawNode:null,
    ctor:function(filename){
        this._super(filename);
        this._debugDrawNode = cc.DrawNode.create();
        this.addChild(this._debugDrawNode, 10);

    },
    draw: function (ctx) {
        // override me
        // Only use- this function to draw your staff.
        // DON'T draw your stuff outside this method
        this._super();

        var anchor = this.getAnchorPoint();
        var size = this.getContentSize();

        this._debugDrawNode.clear();

        var vertices = [
            cc.p(0, 0),
            cc.p(0, size.height),
            cc.p(size.width, size.height),
            cc.p(size.width, 0)
        ];
        this._debugDrawNode.drawPoly(vertices, 4, true, new cc.Color(1.0, 1.0, 1.0, 1.0));
        this._debugDrawNode.drawDot(cc.p(anchor.x * size.width, anchor.y * size.height), 5, new cc.Color(1, 1, 1, 1));

    },
});